<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/resource/jsp/edit_top.jsp"%>
<script language="javascript"
	src="<%=request.getContextPath()%>/resource/js/dialog.js"></script>
<script language="javascript"
	src="<%=request.getContextPath()%>/resource/js/md5.js"></script>
<script type="text/javascript">
window.onload=function(){
	var bo=document.getElementsByName("person.sex");
	var value = "'" + ${person.sex} + "'";
	if(value!="'NaN")
	{
		for(var i=0;i<bo.length;i++)
		{
			if(("'" + bo[i].value + "'")==value)
			{
		 		bo[i].checked=true;
		 	}
		}
	}
}

function conMd5()
{
	var hash=hex_md5(document.getElementById("password").value); 
	document.getElementById("password").value = hash;
	document.getElementById("handlerPanel").style.display='none';
	return true;
}
function selDepartment()
{
	var t =selectList('getDepartmentServiceImp','departmentid','departmentname');
	if(t!=null)
	{
		document.getElementById("postid").value = '';
		document.getElementById("postname").value = '';
	}
}

function selPost()
{
	selectList('getPostServiceImp&departmentid='+document.getElementById("departmentid").value,'postid','postname');
}
</script>
<c:if test="${methodStyle != 'edit'}">
	<form action="save.do" method="post" id="form1">
	<div id="handlerPanel" class="handlerPanel"><input type="submit"
		value="保存" class="btnGray" onclick="return conMd5();" /></div>
</c:if>
<c:if test="${methodStyle == 'edit'}">
	<form action="update.do" method="post" id="form1">
	<div id="handlerPanel" class="handlerPanel"><input type="submit"
		value="保存" class="btnGray" /></div>
</c:if>
<center>
<h3>添加用户</h3>
<s:fielderror cssStyle="color:red;" /> 
<table class="tableClass" width="95%">
	<tr>
		<td class="title">用户名</td>
		<td><input type="text" name="person.userName" class="inputClass"
			value="${person.userName}" /><span style="color: red;">*</span></td>
		<td class="title">姓名</td>
		<td><input type="text" name="person.name" class="inputClass"
			value="${person.name}" /><span style="color: red;">*</span></td>
		<td class="title">编号</td>
		<td><input type="text" name="person.number" class="inputClass"
			value="${person.number}" /><span style="color: red;">*</span></td>
	</tr>
	<tr>
		<td class="title">电话</td>
		<td><input type="text" name="person.callNumber"
			class="inputClass" value="${person.callNumber}" /></td>
		<td class="title">手机</td>
		<td><input type="text" name="person.phoneNumber"
			class="inputClass" value="${person.phoneNumber}" /></td>
		<td class="title">email</td>
		<td><input type="text" name="person.email" class="inputClass"
			value="${person.email}" /></td>
	</tr>
	<tr>
		<td class="title">性别</td>
		<td><input type="radio" name="person.sex" value="0">男</input> <input
			type="radio" name="person.sex" value="1">女</input><span
			style="color: red;">*</span></td>
		<td class="title">部门</td>
		<td><input type="text" id="departmentid"
			name="person.department.id" style="display: none"
			value="${person.department.id}" /> <input type="text"
			id="departmentname" name="person.department.name" class="inputClass"
			value="${person.department.name}" /><span style="color: red;">*</span><a
			href="#"
			onClick="selDepartment();">选择</a></td>
		<td class="title">岗位</td>
		<td><input type="text" id="postid" name="person.post.id"
			style="display: none" value="${person.post.id}" /> <input
			type="text" id="postname" name="person.post.name" class="inputClass"
			value="${person.post.name}" /> <span style="color: red;">*</span><a
			href="#"
			onClick="selPost();">选择</a></td>
	</tr>
	<c:if test="${methodStyle != 'edit'}">
		<tr>
			<td class="title">密码</td>
			<td colspan="5"><input type="password" name="person.password" id="password"
				class="inputClass" /></td>
		</tr>
	</c:if>
	<c:if test="${methodStyle == 'edit'}">
			<input type="password" name="person.password" id="password"
				class="inputClass" value="${person.password}" style="display: none;" />
	</c:if>
</table>
</center>
<input type="text"
	name="person.id" style="display: none" value="${person.id}" />
</form>
<%@ include file="/resource/jsp/edit_down.jsp"%>